// pages/cart/index.js
Page({

  data: {

    address:{},
    cartList:[],
    totalPrice:0,
    totalNum:0

  },
  
  onLoad: function (options) {
    
  },
  onShow: function () {
    let cartList = wx.getStorageSync("cart")||[];
    const address = wx.getStorageSync("address");
    cartList = cartList.filter(v=>v.checked)
    let totalPrice=0;
    let totalNum = 0;
    cartList.forEach(v => {
        totalPrice+=v.num*v.goods_price;
        totalNum+=v.num
    });
    this.setData({
      cartList,
      address,
      totalPrice,
      totalNum
    });
  },



})